<?php

/**
 * Class for viewing an input submit element.
 *
 * @author Ian Clarence <ian.clarence@gmail.com>
 */
class ViewSubmit extends ViewHtmlFormElement {

    /**
     * The constructor.
     *
     * @param array $fields
     */
    public function __construct(array $fields = array()) {

        $fields["tag"] = "input";
        $fields["type"] = isset($fields["type"]) ? $fields["type"] : "submit";
        $fields["name"] = isset($fields["name"]) ? $fields["name"] : "submit";
        $fields['element_id'] = $fields['name'];
        $fields["value"] = isset($fields["value"]) ? $fields["value"] : "Submit";

        parent::__construct($fields);

        $this->setAttribute("type", $this->getType());
        
    }

    /**
     * Make this element a reset button.
     */
    public function setReset() {
        $this->setAttribute("type", "reset");
    }

}